]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
layout: Replace uses of find(Monitor|Index)ForWindow with window.get_monitor()
authorJasper St. Pierre <jstpierre@mecheye.net>
Mon, 28 Jan 2013 19:47:51 +0000 (14:47 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 7 Feb 2013 03:35:10 +0000 (22:35 -0500)
Mutter already does the math for us, so we shouldn't have to do it.

js/ui/layout.js
js/ui/windowManager.js

index 0adc81f0dc16fbbb2e9939a117e3d9be1f842a36..d337aecca7db7d9dab9d3ce78759125297f10954 100644 (file)
@@ -355,7 +355,7 @@ const LayoutManager = new Lang.Class({
         } else {
             let focusWindow = global.display.focus_window;
             if (focusWindow)
-                i = this.findIndexForWindow(focusWindow);
+                i = focusWindow.get_monitor();
         }
 
         return i;
@@ -655,14 +655,6 @@ const LayoutManager = new Lang.Class({
         return -1;
     },
 
-    findIndexForWindow: function(window) {
-        let rect = window.get_input_rect();
-        let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
-        if (i >= 0)
-            return i;
-        return this.primaryIndex; // Not on any monitor, pretend its on the primary
-    },
-
     // This call guarantees that we return some monitor to simplify usage of it
     // In practice all tracked actors should be visible on some monitor anyway
     findIndexForActor: function(actor) {
@@ -674,15 +666,6 @@ const LayoutManager = new Lang.Class({
         return this.primaryIndex; // Not on any monitor, pretend its on the primary
     },
 
-    findMonitorForWindow: function(window) {
-        let rect = window.get_input_rect();
-        let i = this._findMonitorForRect(rect.x, rect.y, rect.width, rect.height);
-        if (i >= 0)
-            return this.monitors[i];
-        else
-            return null;
-    },
-
     findMonitorForActor: function(actor) {
         return this.monitors[this.findIndexForActor(actor)];
     },
@@ -733,7 +716,7 @@ const LayoutManager = new Lang.Class({
                 continue;
 
             if (layer == Meta.StackLayer.FULLSCREEN) {
-                let monitor = this.findMonitorForWindow(metaWindow);
+                let monitor = this.monitors[metaWindow.get_monitor()];
                 if (monitor)
                     monitor.inFullscreen = true;
             }
@@ -750,7 +733,7 @@ const LayoutManager = new Lang.Class({
                 }
 
                 // Or whether it is monitor sized
-                let monitor = this.findMonitorForWindow(metaWindow);
+                let monitor = this.monitors[metaWindow.get_monitor()];
                 if (monitor &&
                     window.x <= monitor.x &&
                     window.x + window.width >= monitor.x + monitor.width &&
index b789d97849f2edaede6b0ecacb56876d38d82ae3..1b6ccad35a96e51afe281b3c55214324818f0b78 100644 (file)
@@ -253,12 +253,9 @@ const WindowManager = new Lang.Class({
             xScale = geom.width / actor.width;
             yScale = geom.height / actor.height;
         } else {
-            /* scale window down to 0x0.  */
-            let monitor = Main.layoutManager.findMonitorForWindow(actor.meta_window);
-            xDest = monitor.x;
-            yDest = monitor.y;
-            xScale = 0.0;
-            yScale = 0.0;
+            let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
+            let xDest = monitor.x;
+            let yDest = monitor.y;
             if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
                 xDest += monitor.width;
         }